package acm.pta;

import java.util.Scanner;

public class A {
    //-10/2
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        sc.nextLine();
        String str = sc.nextLine();
        String[] equation = str.split(" ");
        long[] binary={0,1};
        for (String e : equation) {
            String[] split = e.split("/");
            long top=Long.parseLong(split[0]);
            long bot=Long.parseLong(split[1]);
            add(binary,top,bot);
        }
        if (binary[0]==0){
            System.out.println(binary[0]);
            return;
        }else if(Math.abs(binary[1])==1){
            System.out.println(binary[0]/binary[1]);
            return;
        }else if (Math.abs(binary[0])>Math.abs(binary[1])){
            System.out.print(Math.abs(binary[0]) / Math.abs(binary[1])+" ");
            binary[0]=binary[0]%binary[1];
        }
        if (binary[0]*binary[1]<0){
            binary[0]=-Math.abs(binary[0]);
            binary[1]=Math.abs(binary[1]);
        }
        System.out.println(binary[0]+"/"+binary[1]);
    }
    public static void add(long[] binary,long top,long bot){
        if (binary[1]%bot==0){
            binary[0]+=binary[1]/bot*top;
        }else if (bot%binary[1]==0){
            binary[0]=bot/binary[1]*binary[0]+top;
            binary[1]=bot/binary[1]*binary[1];
        }else {
            top*=binary[1];
            binary[0]*=bot;
            binary[1]*=bot;
            binary[0]+=top;
        }
        long gcd=gcd(
                Math.max(Math.abs(binary[0]),Math.abs(binary[1])),
                Math.min(Math.abs(binary[0]),Math.abs(binary[1]))
                );
        binary[0]/=gcd;
        binary[1]/=gcd;
    }

    public static long gcd(long a,long b){
        if(b == 0)
            return a;
        return gcd(b,a%b);
    }
}
